Fetch Notification Feed
Notification feed is a great way to populate notifications for a user. You can achieve the same with LikeMinds Android SDK, by following the steps given below.
Steps to fetch notification feed
- Create a GetNotificationFeedRequest object using
GetNotificationFeedRequest.Builder
class by passing all the required parameters. - Call
getNotificationFeed()
function using the instance ofLMFeedClient
. - Process the response (LMResponse<GetNotificationFeedResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of GetNotificationFeedRequest
val getNotificationFeedRequest = GetNotificationFeedRequest.Builder()
.page(1) // page number for paginated notification feed data
.pageSize(10) // page size for paginated notification feed data
.build()
// get response (LMResponse<GetNotificationFeedResponse>)
val response = LMFeedClient.getInstance().getNotificationFeed(getNotificationFeedRequest)
if (response.success) {
// your function to process the response dataa
processGetNotificationFeedResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}
Models
GetNotificationFeedRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
page | Int | Page number for paginated notification feed data. | |
pageSize | Int | Page size for paginated notification feed data. |
GetNotificationFeedResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
activities | List<Activity> | List of activities inside notification feed. | |
users | Map<String, User> | Map of user unique id to user object. | |
topics | Map<String, Topic> | Map of topic id to topic object. |